package me.maiz.tool.codemonitor.common;

import java.util.Calendar;
import java.util.Date;

public class DateUtil {

    public static boolean isSameDay(Date date1,Date date2){
        Calendar instance = Calendar.getInstance();
        instance.setTime(date1);
        int day = instance.get(Calendar.DAY_OF_MONTH);
        int month = instance.get(Calendar.MONTH);
        int year = instance.get(Calendar.YEAR);

        Calendar now = Calendar.getInstance();
        now.setTime(date2);
        int nowDay = now.get(Calendar.DAY_OF_MONTH);
        int nowMonth = now.get(Calendar.MONTH);
        int nowYear = now.get(Calendar.YEAR);
        return (day==nowDay)&&(month==nowMonth)&&(year==nowYear);
    }

}
